package com.itheima.homework1.demo3;

public class Test {
    public static void main(String[] args) {
        Animal dog = new Dog("狗", 20);
        dog.eat();
        show(dog);

        System.out.println("--------------------");
        Animal cat = new Cat("猫", 10);
        cat.eat();
        show(cat);


    }
    public static void show(Animal a){
        if(a instanceof Dog){
            Dog dog = (Dog)a;
            dog.lookHome();
        }else if(a instanceof Cat){
            Cat cat = (Cat)a;
            cat.catchMouse();
        }
    }
}
